-
Notifications
You must be signed in to change notification settings - Fork 19
[DBAPI2.0] Fix the description
attribute
#43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DBAPI2.0] Fix the description
attribute
#43
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the spec it's not clear what type_code
is expected to be. Psycopg returns the type's OID and mysql returns a type id, both of which are numbers, but I don't see a good reason to not return a DuckDBPyType...
bdda2b6
to
787d12d
Compare
… but with a much smaller change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
d202b0c
Fixes https://github.com/duckdblabs/duckdb-internal/issues/1217, duckdb/duckdb#10495
This PR should make a better attempt at implementing https://peps.python.org/pep-0249/#type-objects-and-constructors
We add the required type object sentinels:
STRING
NUMBER
DATETIME
BINARY
ROWID
(None, as DuckDB doesn't have a way to detect this on a LogicalType)The objects returned for the
type_code
of thedescription
is aDuckDBPyType
.The sentinels are of type
DBAPITypeObject
and are overloaded to be compared with theDuckDBPyType
objects.The constructors listed by the PEP are not added, they could be added in the future.